from bs4 import BeautifulSoup


def html_parser(html):
    bs = BeautifulSoup(html, "html.parser")
    url = bs.form.get("action")
    imput_list = bs.find_all("input")
    data = {}
    for input in imput_list:
        data[input.get("name")] = input.get("value")
    return url, data


if __name__ == '__main__':
    html = "<form name='easypaysubmit' id='easypaysubmit' target='_blank' method='post' action='http:\/\/121.43.169.97:8000\/muser\/publicRequests'>" \
           "<input name='Version' type='hidden' value='10'\/>" \
           "<input name='CmdId' type='hidden' value='UserRegister'\/>" \
           "<input name='MerCustId' type='hidden' value='6000060007313892'\/>" \
           "<input name='BgRetUrl' type='hidden' value='https:\/\/www.baidu.com\/'\/>" \
           "<input name='RetUrl' type='hidden' value='http:\/\/user-p2p-test.itheima.net\/trust\/chinapnr\/register\/return\/22082322272333301212'\/>" \
           "<input name='UsrId' type='hidden' value=''\/>" \
           "<input name='UsrName' type='hidden' value=''\/>" \
           "<input name='IdType' type='hidden' value='00'\/>" \
           "<input name='IdNo' type='hidden' value='330102199003078870'\/>" \
           "<input name='UsrMp' type='hidden' value='13800000004'\/>" \
           "<input name='UsrEmail' type='hidden' value=''\/>" \
           "<input name='MerPriv' type='hidden' value='22082322272333301212'\/>" \
           "<input name='ChkValue' type='hidden' value='-101'\/>" \
           "<input name='CharSet' type='hidden' value='UTF-8'\/>" \
           "<\/form>" \
           "<script>document.forms['easypaysubmit'].submit();<\/script>"

    res = html_parser(html)
    print(res)
